{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports\n",
    "\n",
    "Import all the modules and functionalities we need."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "# Import standard libraries.\n",
    "import os\n",
    "\n",
    "# Import third party libraries.\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "from statsmodels.stats.multitest import multipletests\n",
    "from statsmodels.stats.proportion import proportions_ztest\n",
    "\n",
    "# Import custom libraries/scripts.\n",
    "import annotations\n",
    "import helpers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loading data\n",
    "\n",
    "Fetch all our relevant data for the current analysis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set working contants.\n",
    "EXPERIMENTS_PATH = r'\\\\10.40.12.80\\home\\PhD\\Results\\Competition\\DL\\small_arenas\\two_females_only\\processed'\n",
    "FPS = 60\n",
    "N_MINUTES = 55\n",
    "N_FRAMES = N_MINUTES * 60 * FPS\n",
    "INK = 'black'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Set figure configurations.\n",
    "sns.set(\n",
    "        context='paper',\n",
    "        style='ticks',\n",
    "        font='sans-serif',\n",
    "        font_scale=1.0, \n",
    "        rc={\n",
    "            'axes.axisbelow': True,\n",
    "            'axes.edgecolor': INK,\n",
    "            'axes.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'axes.grid': False,\n",
    "            'axes.labelcolor': INK,\n",
    "            'axes.labelsize': 13.0,\n",
    "            'axes.labelweight': 'normal',\n",
    "            'axes.linewidth': 1.0,\n",
    "            'axes.spines.left': True,\n",
    "            'axes.spines.bottom': True,\n",
    "            'axes.spines.top': False,\n",
    "            'axes.spines.right': False,\n",
    "            'axes.titlepad': 15.0,\n",
    "            'axes.titlesize': 20.0,\n",
    "            'axes.titleweight': 'bold',\n",
    "            'figure.facecolor': 'white' if INK=='black' else 'black',\n",
    "            'figure.figsize': [4.0, 4.0],\n",
    "            'figure.titlesize': 30.0,\n",
    "            'figure.titleweight': 'bold',\n",
    "            'font.family': ['sans-serif'],\n",
    "            'font.sans-serif': ['Arial'],\n",
    "            'legend.frameon': False,\n",
    "            'legend.fontsize': 11.0,\n",
    "            'lines.color': INK,\n",
    "            'lines.linewidth': 1.0,\n",
    "            'patch.edgecolor': INK,\n",
    "            'savefig.dpi': 300,\n",
    "            'savefig.format': 'png',\n",
    "            'savefig.bbox': 'tight',\n",
    "            'savefig.transparent': True,\n",
    "            'text.color': INK,\n",
    "            'text.usetex': False,\n",
    "            'xtick.color': INK,\n",
    "            'xtick.direction': 'out',\n",
    "            'xtick.labelsize': 12.0,\n",
    "            'xtick.major.pad': 5.0,\n",
    "            'xtick.major.size': 0.0,\n",
    "            'xtick.major.width': 1.0,\n",
    "            'xtick.minor.size': 0.0,\n",
    "            'xtick.minor.width': 0.4,\n",
    "            'ytick.color': INK,\n",
    "            'ytick.direction': 'out',\n",
    "            'ytick.labelsize': 12.0,\n",
    "            'ytick.major.pad': 5.0,\n",
    "            'ytick.major.size': 3.0,\n",
    "            'ytick.major.width': 1.0,\n",
    "            'ytick.minor.size': 0.0,\n",
    "            'ytick.minor.width': 0.4\n",
    "           }\n",
    "       )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Folder already exists, skipping.\n"
     ]
    }
   ],
   "source": [
    "# Prepare the Figures folder to save our graphs in.\n",
    "savepath = os.path.join(r'C:\\Users\\Miguel\\Desktop\\paper_data', 'paper_figures', 'figure4')\n",
    "try:\n",
    "    os.makedirs(savepath)\n",
    "    print('New folder created.')\n",
    "except FileExistsError:\n",
    "    print('Folder already exists, skipping.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Paths to conditions:\n",
      " ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food', '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food']\n"
     ]
    }
   ],
   "source": [
    "# Set the conditions to analyze.\n",
    "condition_order = ['food', 'no_food']\n",
    "conditions = [item.path for item in os.scandir(EXPERIMENTS_PATH) if item.name in condition_order]\n",
    "print('Paths to conditions:\\n', conditions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'food': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T10_41_16_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-12T11_37_33_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_01_30_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T10_57_35_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\food\\\\video_2019-12-18T11_55_14_arena9.csv'],\n",
       " 'no_food': ['\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T10_41_16_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-12T11_37_33_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena1.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena2.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena5.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena6.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_01_30_arena8.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena10.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena13.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena14.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T10_57_35_arena9.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena11.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena12.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena15.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena16.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena3.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena4.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena7.csv',\n",
       "  '\\\\\\\\10.40.12.80\\\\home\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\small_arenas\\\\two_females_only\\\\processed\\\\no_food\\\\video_2019-12-18T11_55_14_arena8.csv']}"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Load all usable experiments for each condition.\n",
    "experiments = {condition: [] for condition in condition_order}\n",
    "\n",
    "for condition_path in conditions:\n",
    "    for item in os.scandir(condition_path):\n",
    "        \n",
    "        experiments[os.path.basename(condition_path)].append(item.path)\n",
    "\n",
    "experiments"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Aggression Analysis"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iteration: 0 \n",
      "Experiment: video_2019-12-12T10_41_16_arena11.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2019-12-12T10_41_16_arena12.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2019-12-12T10_41_16_arena15.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2019-12-12T10_41_16_arena16.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2019-12-12T10_41_16_arena3.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2019-12-12T10_41_16_arena4.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2019-12-12T10_41_16_arena7.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2019-12-12T10_41_16_arena8.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2019-12-12T11_37_33_arena10.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2019-12-12T11_37_33_arena13.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2019-12-12T11_37_33_arena14.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2019-12-12T11_37_33_arena2.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2019-12-12T11_37_33_arena5.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2019-12-12T11_37_33_arena6.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-12-12T11_37_33_arena9.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-12-18T10_01_30_arena10.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-12-18T10_01_30_arena11.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-12-18T10_01_30_arena12.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-12-18T10_01_30_arena13.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-12-18T10_01_30_arena14.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-12-18T10_01_30_arena15.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-12-18T10_01_30_arena16.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-12-18T10_01_30_arena9.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2019-12-18T10_57_35_arena1.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2019-12-18T10_57_35_arena2.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2019-12-18T10_57_35_arena3.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2019-12-18T10_57_35_arena4.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 27 \n",
      "Experiment: video_2019-12-18T10_57_35_arena5.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 28 \n",
      "Experiment: video_2019-12-18T10_57_35_arena6.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 29 \n",
      "Experiment: video_2019-12-18T10_57_35_arena7.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 30 \n",
      "Experiment: video_2019-12-18T10_57_35_arena8.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 31 \n",
      "Experiment: video_2019-12-18T11_55_14_arena1.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 32 \n",
      "Experiment: video_2019-12-18T11_55_14_arena10.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 33 \n",
      "Experiment: video_2019-12-18T11_55_14_arena13.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 34 \n",
      "Experiment: video_2019-12-18T11_55_14_arena14.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 35 \n",
      "Experiment: video_2019-12-18T11_55_14_arena2.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 36 \n",
      "Experiment: video_2019-12-18T11_55_14_arena5.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 37 \n",
      "Experiment: video_2019-12-18T11_55_14_arena6.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 38 \n",
      "Experiment: video_2019-12-18T11_55_14_arena9.csv \n",
      "Condition: food \n",
      "\n",
      "Iteration: 0 \n",
      "Experiment: video_2019-12-12T10_41_16_arena1.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2019-12-12T10_41_16_arena10.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2019-12-12T10_41_16_arena13.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2019-12-12T10_41_16_arena14.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2019-12-12T10_41_16_arena2.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2019-12-12T10_41_16_arena5.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2019-12-12T10_41_16_arena6.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2019-12-12T10_41_16_arena9.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2019-12-12T11_37_33_arena11.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2019-12-12T11_37_33_arena12.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2019-12-12T11_37_33_arena15.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2019-12-12T11_37_33_arena16.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2019-12-12T11_37_33_arena3.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2019-12-12T11_37_33_arena4.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-12-12T11_37_33_arena7.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-12-12T11_37_33_arena8.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-12-18T10_01_30_arena1.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-12-18T10_01_30_arena2.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-12-18T10_01_30_arena3.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-12-18T10_01_30_arena4.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-12-18T10_01_30_arena5.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-12-18T10_01_30_arena6.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-12-18T10_01_30_arena7.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2019-12-18T10_01_30_arena8.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2019-12-18T10_57_35_arena10.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2019-12-18T10_57_35_arena11.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2019-12-18T10_57_35_arena12.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 27 \n",
      "Experiment: video_2019-12-18T10_57_35_arena13.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 28 \n",
      "Experiment: video_2019-12-18T10_57_35_arena14.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 29 \n",
      "Experiment: video_2019-12-18T10_57_35_arena15.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 30 \n",
      "Experiment: video_2019-12-18T10_57_35_arena16.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 31 \n",
      "Experiment: video_2019-12-18T10_57_35_arena9.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 32 \n",
      "Experiment: video_2019-12-18T11_55_14_arena11.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 33 \n",
      "Experiment: video_2019-12-18T11_55_14_arena12.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 34 \n",
      "Experiment: video_2019-12-18T11_55_14_arena15.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 35 \n",
      "Experiment: video_2019-12-18T11_55_14_arena16.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 36 \n",
      "Experiment: video_2019-12-18T11_55_14_arena3.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 37 \n",
      "Experiment: video_2019-12-18T11_55_14_arena4.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 38 \n",
      "Experiment: video_2019-12-18T11_55_14_arena7.csv \n",
      "Condition: no_food \n",
      "\n",
      "Iteration: 39 \n",
      "Experiment: video_2019-12-18T11_55_14_arena8.csv \n",
      "Condition: no_food \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>has_food</th>\n",
       "      <th>nframes</th>\n",
       "      <th>nbouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>25</td>\n",
       "      <td>6</td>\n",
       "      <td>0.001389</td>\n",
       "      <td>1.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-12T10_41_16_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>43</td>\n",
       "      <td>4</td>\n",
       "      <td>0.002389</td>\n",
       "      <td>0.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-12T10_41_16_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>15</td>\n",
       "      <td>5</td>\n",
       "      <td>0.000833</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-12T10_41_16_arena15.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000167</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-12T10_41_16_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>125</td>\n",
       "      <td>2</td>\n",
       "      <td>0.006944</td>\n",
       "      <td>0.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-12T10_41_16_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>76</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>77</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>37</td>\n",
       "      <td>4</td>\n",
       "      <td>0.002056</td>\n",
       "      <td>0.8</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena8.csv</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>79 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    has_aggression  has_food  nframes  nbouts  ratio_frames  ratio_bouts  \\\n",
       "0             True      True       25       6      0.001389          1.2   \n",
       "1             True      True       43       4      0.002389          0.8   \n",
       "2             True      True       15       5      0.000833          1.0   \n",
       "3             True      True        3       1      0.000167          0.2   \n",
       "4             True      True      125       2      0.006944          0.4   \n",
       "..             ...       ...      ...     ...           ...          ...   \n",
       "74           False     False        0       0      0.000000          0.0   \n",
       "75           False     False        0       0      0.000000          0.0   \n",
       "76           False     False        0       0      0.000000          0.0   \n",
       "77           False     False        0       0      0.000000          0.0   \n",
       "78            True     False       37       4      0.002056          0.8   \n",
       "\n",
       "   condition                             experiment  \n",
       "0       food  video_2019-12-12T10_41_16_arena11.csv  \n",
       "1       food  video_2019-12-12T10_41_16_arena12.csv  \n",
       "2       food  video_2019-12-12T10_41_16_arena15.csv  \n",
       "3       food  video_2019-12-12T10_41_16_arena16.csv  \n",
       "4       food   video_2019-12-12T10_41_16_arena3.csv  \n",
       "..       ...                                    ...  \n",
       "74   no_food  video_2019-12-18T11_55_14_arena16.csv  \n",
       "75   no_food   video_2019-12-18T11_55_14_arena3.csv  \n",
       "76   no_food   video_2019-12-18T11_55_14_arena4.csv  \n",
       "77   no_food   video_2019-12-18T11_55_14_arena7.csv  \n",
       "78   no_food   video_2019-12-18T11_55_14_arena8.csv  \n",
       "\n",
       "[79 rows x 8 columns]"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "aggression_df = pd.DataFrame()\n",
    "for condition in condition_order:\n",
    "    for h, experiment_path in enumerate(experiments[condition]):\n",
    "\n",
    "        experiment = os.path.basename(experiment_path)\n",
    "        \n",
    "        print('Iteration:', h, '\\nExperiment:', experiment, '\\nCondition:', condition, '\\n')\n",
    "        \n",
    "        annotation_video = annotations.read(experiment_path)\n",
    "        \n",
    "        try:\n",
    "            arena_start = annotation_video[0].events[0].time\n",
    "        except IndexError:\n",
    "            continue\n",
    "        \n",
    "        # Get aggression only from minute 5 to minute 10.\n",
    "        aggression_events = []\n",
    "        for event in annotation_video[1].events:\n",
    "            if (event.time >= (arena_start + 5 * 60 * FPS) and event.time < (arena_start + 10 * 60 * FPS)):\n",
    "                aggression_events.append(event)\n",
    "                \n",
    "        n_events = len(aggression_events)\n",
    "\n",
    "        # In case there is aggression, do the necessary calculations.\n",
    "        if n_events > 0:\n",
    "            ratio_frames = sum([aggression.duration for aggression in aggression_events]) / (5 * 60 * FPS) # Although the movies are 55 minutes long, we only annotated the first 15 minutes of each video.\n",
    "            ratio_bouts = n_events / 5\n",
    "\n",
    "            aggression_data = pd.DataFrame({'has_aggression': True,\n",
    "                                            'has_food': True if condition == 'food' else False,\n",
    "                                            'nframes': sum([aggression.duration for aggression in aggression_events]),\n",
    "                                            'nbouts': n_events,\n",
    "                                            'ratio_frames': ratio_frames,\n",
    "                                            'ratio_bouts': ratio_bouts,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # If not, preset our dictionary with default values.\n",
    "        else:\n",
    "            aggression_data = pd.DataFrame({'has_aggression': False,\n",
    "                                            'has_food': True if condition == 'food' else False,\n",
    "                                            'nframes': 0,\n",
    "                                            'nbouts': 0,\n",
    "                                            'ratio_frames': 0, \n",
    "                                            'ratio_bouts': 0,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # Concatenate all data together.\n",
    "        aggression_df = pd.concat([aggression_df, aggression_data], ignore_index=True)\n",
    "\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Outlier Detection"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t food \n",
      "\n",
      "[10, 16]\n",
      "Number data points considered outliers: 2\n",
      "Percent data points considered outliers: 5.128 %\n",
      "\n",
      "\t no_food \n",
      "\n",
      "[47]\n",
      "Number data points considered outliers: 1\n",
      "Percent data points considered outliers: 2.5 %\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>has_food</th>\n",
       "      <th>nframes</th>\n",
       "      <th>nbouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>25</td>\n",
       "      <td>6</td>\n",
       "      <td>0.001389</td>\n",
       "      <td>1.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-12T10_41_16_arena11.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>43</td>\n",
       "      <td>4</td>\n",
       "      <td>0.002389</td>\n",
       "      <td>0.8</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-12T10_41_16_arena12.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>15</td>\n",
       "      <td>5</td>\n",
       "      <td>0.000833</td>\n",
       "      <td>1.0</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-12T10_41_16_arena15.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000167</td>\n",
       "      <td>0.2</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-12T10_41_16_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>True</td>\n",
       "      <td>125</td>\n",
       "      <td>2</td>\n",
       "      <td>0.006944</td>\n",
       "      <td>0.4</td>\n",
       "      <td>food</td>\n",
       "      <td>video_2019-12-12T10_41_16_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>74</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena16.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena3.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>76</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena4.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>77</th>\n",
       "      <td>False</td>\n",
       "      <td>False</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena7.csv</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>78</th>\n",
       "      <td>True</td>\n",
       "      <td>False</td>\n",
       "      <td>37</td>\n",
       "      <td>4</td>\n",
       "      <td>0.002056</td>\n",
       "      <td>0.8</td>\n",
       "      <td>no_food</td>\n",
       "      <td>video_2019-12-18T11_55_14_arena8.csv</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>76 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    has_aggression  has_food  nframes  nbouts  ratio_frames  ratio_bouts  \\\n",
       "0             True      True       25       6      0.001389          1.2   \n",
       "1             True      True       43       4      0.002389          0.8   \n",
       "2             True      True       15       5      0.000833          1.0   \n",
       "3             True      True        3       1      0.000167          0.2   \n",
       "4             True      True      125       2      0.006944          0.4   \n",
       "..             ...       ...      ...     ...           ...          ...   \n",
       "74           False     False        0       0      0.000000          0.0   \n",
       "75           False     False        0       0      0.000000          0.0   \n",
       "76           False     False        0       0      0.000000          0.0   \n",
       "77           False     False        0       0      0.000000          0.0   \n",
       "78            True     False       37       4      0.002056          0.8   \n",
       "\n",
       "   condition                             experiment  \n",
       "0       food  video_2019-12-12T10_41_16_arena11.csv  \n",
       "1       food  video_2019-12-12T10_41_16_arena12.csv  \n",
       "2       food  video_2019-12-12T10_41_16_arena15.csv  \n",
       "3       food  video_2019-12-12T10_41_16_arena16.csv  \n",
       "4       food   video_2019-12-12T10_41_16_arena3.csv  \n",
       "..       ...                                    ...  \n",
       "74   no_food  video_2019-12-18T11_55_14_arena16.csv  \n",
       "75   no_food   video_2019-12-18T11_55_14_arena3.csv  \n",
       "76   no_food   video_2019-12-18T11_55_14_arena4.csv  \n",
       "77   no_food   video_2019-12-18T11_55_14_arena7.csv  \n",
       "78   no_food   video_2019-12-18T11_55_14_arena8.csv  \n",
       "\n",
       "[76 rows x 8 columns]"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "corrected_ratio_frames = pd.DataFrame()\n",
    "\n",
    "for condition in condition_order:\n",
    "\n",
    "    print('\\n\\t', condition, '\\n')\n",
    "\n",
    "    try:\n",
    "        dataset = aggression_df.query('condition==\"' + condition + '\"')['ratio_frames']\n",
    "\n",
    "        outlier_positions = helpers.check_outliers(dataset)\n",
    "        print(outlier_positions)\n",
    "\n",
    "        fresh_dataset = pd.DataFrame(helpers.remove_outliers(dataset, indices=outlier_positions))\n",
    "        fresh_dataset['condition'] = condition\n",
    "\n",
    "        corrected_ratio_frames = pd.concat([corrected_ratio_frames, fresh_dataset], axis=0)\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "\n",
    "aggression_df = aggression_df.loc[corrected_ratio_frames.index]\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Aggression Rate"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>condition</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>has_food</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>food</td>\n",
       "      <td>0.001389</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>food</td>\n",
       "      <td>0.002389</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>food</td>\n",
       "      <td>0.000833</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>food</td>\n",
       "      <td>0.000167</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>food</td>\n",
       "      <td>0.006944</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  condition  ratio_frames  has_food\n",
       "0      food      0.001389      True\n",
       "1      food      0.002389      True\n",
       "2      food      0.000833      True\n",
       "3      food      0.000167      True\n",
       "4      food      0.006944      True"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_df = aggression_df.copy()[['condition', 'ratio_frames', 'has_food']]\n",
    "ratio_frames_df.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\t no_food \n",
      "\n",
      "Shapiro's Test: group 1 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 1 IS NOT normally distributed.\n",
      "Shapiro's Test: group 2 IS NOT normally distributed.\n",
      "D'Agostino's Test: group 2 IS NOT normally distributed.\n",
      "Levene's Test for non-normally distributed samples:\n",
      "  p-value = 0.297852\n",
      "  All groups were sampled from populations with IDENTICAL variances.\n",
      "\n",
      "Mann-Whitney p-value: 0.3304783635605188 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'no_food': 0.3304783635605188}"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_pvalues = {}\n",
    "\n",
    "control = ratio_frames_df.query('condition==\"food\"')['ratio_frames']\n",
    "\n",
    "for condition in condition_order[1:]:\n",
    "\n",
    "    print('\\n\\t', condition, '\\n')\n",
    "\n",
    "    try:\n",
    "        test = ratio_frames_df.query('condition==\"' + condition + '\"')['ratio_frames']\n",
    "\n",
    "        temp_values = {'control': control, 'test': test}\n",
    "\n",
    "        pvalue_condition = helpers.run_statistics(temp_values)\n",
    "\n",
    "        ratio_frames_pvalues[condition] = pvalue_condition\n",
    "        \n",
    "    except ValueError as error:\n",
    "        print(error)\n",
    "    \n",
    "ratio_frames_pvalues"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Effect Size"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "no_food\n",
      "Vestigial Effect: 0.0952380952380952 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'no_food': 0.0952380952380952}"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ratio_frames_effect_sizes = {}\n",
    "\n",
    "control = ratio_frames_df.query('condition==\"food\"')['ratio_frames']\n",
    "\n",
    "for condition in condition_order[1:]:\n",
    "    \n",
    "    print(condition)\n",
    "    \n",
    "    test = ratio_frames_df.query('condition==\"' + condition +'\"')['ratio_frames']\n",
    "\n",
    "    median_diff = helpers.get_effect_size(control, test, method='median_diff')\n",
    "\n",
    "    ratio_frames_effect_sizes[condition] = median_diff\n",
    "    \n",
    "ratio_frames_effect_sizes"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Plot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAMIAAAEgCAYAAADmGqwMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO3dd3hUVfrA8e9MKumdJKQRCKGkIQRCAAkgSAcBBVkEXFFBsay9G36Lu5ZV1wVd1lVB+ooNBIQsvQYIEHoJ6Y30MqmTmTm/P7I7mCUJA2QyA5zP8/A8zL13bt57Z9455957ikIIIZCku5zS1AFIkjmQiSBJyESQJEAmgiQBMhEkCZCJIElAOyXCqlWriIyMJCoqitjYWJKSkq7Z5sUXXyQgIICoqCiioqKYNm1ae4QmSY2EkV24cEF4e3uLvLw8IYQQmzdvFv7+/tdsFxMTIw4cOGDscCSpWQohjPtALSMjg7Nnz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eYba6tjzsiIoLXX3+dIUOG0L17d8rLy1m0aBEA77//PuPGjWPAgAGEhobq3zNq1CjmzZvHwYMH2/jompJ9liUJWSJIEiATQZIAmQiSBMhEMMjvf/97goODWbt27U3v43Zud9SSO+m8yJHuDLB8+XLq6urMcvBaU7qTzossEa5jwoQJCCHo168fH3zwQbPtZDZt2kRUVBQRERFMmjSJgoICABISEujVqxd9+vTRj5Z9p7jjzovRG3HcAYAW28kUFBQIX19fkZ6eLoQQ4sMPPxRTp04VdXV1wtvbW5w7d04IIcRjjz2mb4tzp7iTzossEQzUUjuZI0eO0K9fP4KCgposP336NL6+vvTo0QOA2bNnmyp0o7pTzotMBAO11E6mpeX/267ot21v7iR3ynmRiWCgltrJ9O/fn8TERDIyMoDGGXOGDh1KREQEBQUFnDx5EuCW7qyYszvlvJhHOt4GfttOpqGhgT59+rB06VIcHR358ssveeCBB1Cr1QQGBvL1119jZWXF2rVreeSRR7C0tOSee+4x9SEYxZ1yXmRbI0lCVo0kCZCJIEmATARJAmQiSBIgE0GSAJkIkgTIRJAkQCaCJAEyESQJkIkgSQD8P5k1uMhCxNCxAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 180x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Initialize figure.\n",
    "n_conditions = ratio_frames_df['condition'].nunique()\n",
    "figure, axis = plt.subplots(figsize=(1.25*n_conditions, 4))\n",
    "\n",
    "# Draw the boxplot.\n",
    "sns.boxplot(x='condition',\n",
    "            y='ratio_frames',\n",
    "            data=ratio_frames_df,\n",
    "            order=condition_order,\n",
    "            palette=['steelblue', '#5e6472'],\n",
    "            width=0.6,\n",
    "            showfliers=False,\n",
    "            boxprops={'edgecolor': INK},\n",
    "            medianprops={'color': INK},\n",
    "            whiskerprops={'color': INK},\n",
    "            capprops={'color': INK}\n",
    "           )\n",
    "\n",
    "# Draw the swarmplot.\n",
    "sns.swarmplot(x='condition',\n",
    "              y='ratio_frames',\n",
    "              data=ratio_frames_df,\n",
    "              order=condition_order,\n",
    "              palette=['steelblue', '#5e6472'],\n",
    "              linewidth=0.75,\n",
    "              edgecolor=INK\n",
    "             )\n",
    "\n",
    "# Figure and axes formatting.\n",
    "axis.set_xlabel('')\n",
    "axis.set_xticklabels([''])\n",
    "axis.set_ylabel('Aggression Rate (%)')\n",
    "axis.set_ylim(0, 0.025)\n",
    "axis.set_yticks(np.arange(0, 0.025+0.001, 0.005))\n",
    "axis.set_yticklabels([round(y*100, 2) for y in axis.get_yticks()])\n",
    "\n",
    "# Table definition.\n",
    "row1 = [str(ratio_frames_df.query('condition==\"'+condition+'\"').shape[0]) for condition in condition_order]\n",
    "row2 = ['With\\nfood', 'Without\\nfood']\n",
    "cell_text = np.array([row1, row2])\n",
    "\n",
    "row_labels = ['n =', '']\n",
    "summary_table = axis.table(cellText= cell_text,\n",
    "                           cellLoc='center',\n",
    "                           rowLabels=row_labels,\n",
    "                           rowLoc='center',\n",
    "                           colLoc='center'\n",
    "                          )\n",
    "\n",
    "summary_table.auto_set_font_size(False)\n",
    "summary_table.set_fontsize(11)\n",
    "\n",
    "properties = summary_table.properties()\n",
    "table_cells = properties['children']\n",
    "for cell in table_cells:\n",
    "    cell.set_height(0.12)\n",
    "    cell.set_alpha(0)\n",
    "\n",
    "# Draw statistical result.\n",
    "for p, condition in enumerate(condition_order[1:]):\n",
    "    sig_height = 6 if (ratio_frames_pvalues.get(condition, 'NaN') == 'NaN') or (ratio_frames_pvalues.get(condition, 'NaN') >= 0.05) else 2\n",
    "    helpers.plot_stattest_result(ax=axis,\n",
    "                                 x1=p+1,\n",
    "                                 x2=p+1,\n",
    "                                 p_value=ratio_frames_pvalues.get(condition, 'NaN'),\n",
    "                                 y=0.022,\n",
    "                                 ticksize=0,\n",
    "                                 xytext=(0,sig_height),\n",
    "                                 fontsize=13,\n",
    "                                 color=INK,\n",
    "                                 connector_color=INK\n",
    "                                )\n",
    "\n",
    "# Saving parameters.\n",
    "filename = 'aggression_rate_5mins_females_alone'\n",
    "plt.savefig(os.path.join(savepath, filename))\n",
    "\n",
    "plt.show()\n",
    "plt.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
